<template>
  <el-drawer append-to-body v-model="drawer" direction="rtl" size="41%">
    <el-card class="algorithm-card" shadow="hover">
      <template #header>
        <div class="card-header">
          <span>算法策略</span>
        </div>
      </template>
      <el-form ref="edit" :model="algorithmEdit" :rules="editRules" class="detail-form" label-position="right"
        label-width="100px">
        <el-form-item label="业务场景">
          <el-select v-model="algorithmEdit.business" placeholder="请选择相关业务场景">
            <el-option label="入库上架" value="将托盘放入目标货位" />
            <el-option label="库存管理" value="对于库存批次及有效期检测" />
            <el-option label="库内盘点" value="清点库存消除库存差异" />
            <el-option label="出库分配" value="订单配货平衡拣选" />
            <el-option label="补货策略" value="提前备料提高效率" />
          </el-select>
        </el-form-item>
        <el-form-item label="策略编码">
          <el-select v-model="algorithmEdit.algorithmNo" placeholder="请选择相关策略编码">
            <el-option label="UP_001" value="将托盘放入目标货位" />
            <el-option label="UP_002" value="对于库存批次及有效期检测" />
            <el-option label="OUT_001" value="清点库存消除库存差异" />
            <el-option label="CHECK_001" value="动态盘点算法" />
            <el-option label="PICK_001" value="提前备料提高效率" />
          </el-select>
        </el-form-item>
        <el-form-item label="策略名称">
          <el-select v-model="algorithmEdit.algorithmName">
            <el-option label="就近策略" value="就近策略" />
            <el-option label="ABC分类上架策略" value="ABC分类上架策略" />
            <el-option label="家族分组上架策略" value="家族分组上架策略" />
            <el-option label="订单波次策略" value="订单波次策略" />
            <el-option label="动态盘点算法" value="动态盘点算法" />
          </el-select>
        </el-form-item>
        <el-form-item label="策略类型">
          <el-select v-model="algorithmEdit.algorithmType">
            <el-option label="上架" value="上架" />
            <el-option label="配货" value="配货" />
            <el-option label="备货" value="备货" />
            <el-option label="库存" value="库存" />
            <el-option label="盘点" value="盘点" />
          </el-select>
        </el-form-item>
        <el-form-item label="策略详情">
          <el-input v-model="algorithmEdit.algorithmInfo" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="confirm">应用策略</el-button>
          <el-button type="info" @click="close">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </el-drawer>
</template>


<script setup name="algorithm">
import { reactive, ref, onMounted } from 'vue';

const refresh = () => { emit('refresh') }
const emit = defineEmits(['refresh'])
let drawer = defineModel()

let edit = ref()

const { proxy } = getCurrentInstance();

const algorithmEdit = ref({
  business: null,
  algorithmNo: null,
  algorithmName: null,
  algorithmType: null,
  algorithmInfo: '基于帕累托法则，根据动销率、库存天数或盘点差异记录等因素，计算盘点优先级，且优先盘点高价值物料',
  comments: null,
});


// 库区与包装信息的选项卡
const algorithmOptions = ref([]);

function confirm() {
  console.log('应用当前算法策略')
}

function close() {
  drawer.value = false
}

</script>
